package com.harvest.scientific.ladder.page.fa

import android.graphics.Color
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import com.harvest.scientific.ladder.R
import com.harvest.scientific.ladder.base.BaseFragment
import com.harvest.scientific.ladder.databinding.AuditingFragmentBinding
import com.harvest.scientific.ladder.ext.formatToNumber
import com.harvest.scientific.ladder.ext.notEmpty
import com.harvest.scientific.ladder.ext.setMaterialDrawable
import com.harvest.scientific.ladder.page.ui.main.MainViewModel
import com.harvest.scientific.ladder.util.StbarUtil
import com.harvest.scientific.ladder.widget.BaseActionBar
import kotlinx.coroutines.launch

/**
 * bytedance
 * @author zenglw
 * @date   2024/6/12 21:17
 */
class AuditingFragment: BaseFragment<AuditingFragmentBinding>() {


    private val viewModel by viewModels<MainViewModel> ({ requireActivity()})
    override fun initPage() {
        super.initPage()

        initListener()
    }

    private fun initListener() {

        lifecycleScope.launch {
            launch {
                viewModel.dislikeRoughSpe.collect {res->
                    _binding.daikuanTv.text = res.vastAnotherMemory
                    _binding.yingshouTv.text = getString(R.string.xof, res.gentleBoyActualTailor.toString().formatToNumber())

                }
            }
        }
    }

    override fun setStatus(actionBar: BaseActionBar) {
        actionBar.apply {
            setTitle(getString(R.string.app_name))
            setBlackMode(true)
            _parentBinding.root.setMaterialDrawable(0f, Color.WHITE)
            StbarUtil.setStatusBar(requireActivity(), true, Color.TRANSPARENT, true)
        }
    }

    companion object {
        fun newInstance() = AuditingFragment()
    }
}